package com.kpy.consumer.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;

/**
 * @auther: kpy
 * @version: 1.0
 * @Package: com.kpy.consumer.model
 * @data: 2022-3-1 19:26
 * @discription:
 **/

@Entity
@Table(name = "user")
//在json序列化时忽略bean中的一些不需要转化的属性
@JsonIgnoreProperties(value = { "hibernateLazyInitializer", "handler" })
public class User {
    @Id
    @Column(name = "id")
    private long id;

    @Column(name = "name", length = 40)
    @NotNull
    private String name;

    @Column(name = "age")
    @Min(1)
    private int age;

    @Column(name = "balance")
    private BigDecimal balance;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public BigDecimal getBalance() {
        return balance;
    }

    public void setBalance(BigDecimal balance) {
        this.balance = balance;
    }
}


